let express=require('express');
let router=express.Router();
let articleController=require('../controller/articleController');
// 渲染发表文章的页面
router.get('/article/add',(req,res)=>{
    if(!req.session.islogin) return res.redirect('/')
    res.render('article/add',{
        user:req.session.user
    })
})


// 处理页面发送过来的post请求
router.post('/article/post',articleController.handlePostArticle)
// 处理详情页发送过来的get请求
router.get('/article/detail',articleController.showArticalDetail)
// 处理编辑页的get请求
router.get('/article/edit',articleController.showArticleEdit)
// 处理编辑页的post请求
router.post('/article/edit',articleController.handleEditPost)

module.exports=router;